<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .body{
            text-align: center;
        }
        .paodao{
            width: 820px;
            height: 400px;
            border: 1px solid black;
            margin: 0px auto;
            position: absolute;
            background-color:pink;
        }
        .car{
            width: 200px;
            height: 100px;
            
            margin: 100px 0px;
            position: absolute;
        }
        .car{
            background-color:yellow;
        }
    </style>
</head>
<body>
    <div class="paodao" id="paodao">
        <div class="car" id="red"></div>
    </div>
</body>
    <script>
        var temp=document.getElementById("red");
        var left=0;
        var flag= setInterval(function(){
            if(left==600)
            {
                clearInterval(flag);
            }
            left+=20;
            temp.style.left=left+"px";
        },38);
    </script>
</html>